<template>
  <el-main>
    <Navbar></Navbar>
    <div id="chart" style="height:80vh"></div>
  </el-main>
</template>

<script>
import * as echarts from 'echarts'
import { getReportMember } from '@/api'

export default {
  methods: {
    drawChart() {
      getReportMember().then((res) => {
        let myChart = echarts.init(document.getElementById('chart'));
        myChart.setOption({
          title: {
            text: '会员数量'
          },
          tooltip: {},
          legend: {
            data: ['会员数量']
          },
          xAxis: {
            data: res.data.data.months//动态数据
          },
          yAxis: {
            type: 'value'
          },
          series: [{
            name: '会员数量',
            type: 'line',
            data: res.data.data.memberCount
          }]
        })
      })
    }
  },
  mounted() {
    this.drawChart()
  }
}
</script>

<style lang="less">

</style>